]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Avoid breaking drag state on cancellation
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 10 Sep 2018 12:24:57 +0000 (14:24 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Sat, 26 Jan 2019 23:38:50 +0000 (23:38 +0000)
In the case where the draggable has an actor of its own, state could be
left broken when dragging on a place that would not accept the DnD op.
After button release, drag state is set to "cancelled" and the animation
begins. After the animation is finished, the drag actor would be destroyed
before disconnecting from its destroy handler.

Within the destroy handler, the grab would be undone but drag state would
be left on "cancelled" state for subsequent operations. This results in
DnD oddities and stuck grabs.

In order to fix this, double check in the actor destroy handler that we
are actually dragging before setting the "cancelled" state.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/540
js/ui/dnd.js

index 0562c7cbdb178ca0047137f84f3c5cd812643ee5..23af7ba95e31d90df991be9bee08fa439c07c4a7 100644 (file)
@@ -374,7 +374,8 @@ var _Draggable = class _Draggable {
             this._finishAnimation();
 
             this._dragActor = null;
-            this._dragState = DragState.CANCELLED;
+            if (this._dragState == DragState.DRAGGING)
+                this._dragState = DragState.CANCELLED;
         });
         this._dragOrigOpacity = this._dragActor.opacity;
         if (this._dragActorOpacity != undefined)